<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input type="checkbox" id="checkbox" checked />
    <script>
      const checkbox = document.getElementById("checkbox");

      setTimeout(() => {
        // checkbox.setAttribute("checked", "");
        // checkbox.removeAttribute("checked");

        checkbox.checked = false;

        console.log(checkbox.getAttribute("checked"));

        if (checkbox.checked) {
          console.log("选中");
        } else {
          console.log("未选中");
        }
      }, 4000);
    </script>
  </body>
</html>
